package com.lagou.config;/*
 *Author:cxz
 *@Date:${Date}
 */

import org.springframework.cloud.gateway.filter.ratelimit.KeyResolver;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
import reactor.core.publisher.Mono;

/*
@ClassName LimitConfig

*@Description
*@Author cxz
*@Date 2020/7/11 11:19
*Version V1.0
*/
@Component
public class LimitConfig {

    @Bean
    public KeyResolver ipKeyResolver() {
        return exchange -> Mono.just(exchange.getRequest().getRemoteAddress().getHostName());
    }
}
